package com.highspeed.bdk.gateway.netty.analyze.client;

import com.highspeed.bdk.gateway.Util;
import com.highspeed.bdk.gateway.entity.*;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

/**
 * 具体解析方法
 */
public class DecodeUtils {

    private static int INT_LENGTH = 4;

    private static int SHORT_LENGTH = 2;

    private static int CHAR_LENGTH = 1;

    private static int LONG_LENGTH = 8;

    /**
     * 解析初始化信息
     *
     * @param file
     * @return
     * @throws IOException
     */

    public static Object decodeInitFbData(File file) throws IOException {

        if (!file.exists()) {
            return null;
        }
        byte[] initFbDataByte = Util.getContent(file.getPath());

        int offset = 0;
        //解析前12个字节数为头部
        short startTag = Util.getShort(initFbDataByte, offset);
        System.out.println("开始标志............." + startTag);
        offset += 2;
        short reqpacketId = Util.getShort(initFbDataByte, offset);
        System.out.println("请求序号............." + reqpacketId);
        offset += 2;
        short fbpacketId = Util.getShort(initFbDataByte, offset);
        System.out.println("反馈包的序列号............." + fbpacketId);
        offset += 2;
        short fbOperType = Util.getShort(initFbDataByte, offset);
        System.out.println("反馈包的操作号............." + fbOperType);
        offset += 2;
        int dataLen = Util.getInt(initFbDataByte, offset);
        System.out.println("数据长度............." + dataLen);
        offset += 4;

        //初始化第一个字节转为Bit字符串
        String bit = Util.byteToBit(initFbDataByte[offset]);
        String reserved = bit.substring(0, 6);
        System.out.println("reserved............." + reserved);
        String dataVersion = bit.substring(6, 8);
        System.out.println("dataVersion............." + dataVersion);//01小网络模式 ,10大网络模式, 11保留
        offset += CHAR_LENGTH;
        byte resevred1 = Util.getByte(initFbDataByte, offset);
        System.out.println("resvered1.........." + resevred1);
        offset += CHAR_LENGTH;
        short resevred2 = Util.getShort(initFbDataByte, offset);
        System.out.println("resevred2.........." + resevred2);
        offset += SHORT_LENGTH;
        int boardSum = Util.getInt(initFbDataByte, offset);
        System.out.println("板卡数量........." + boardSum);
        offset += INT_LENGTH;

        int deviceNodeSum = Util.getInt(initFbDataByte, offset);
        System.out.println("芯片节点数量........." + deviceNodeSum);
        offset += INT_LENGTH;

        int phyLinkSum = Util.getInt(initFbDataByte, offset);
        System.out.println("物理链路数量........." + phyLinkSum);
        offset += INT_LENGTH;

        int phyPortSum = Util.getInt(initFbDataByte, offset);
        System.out.println("物理端口数量........." + phyPortSum);
        offset += INT_LENGTH;

        InitFbData initFbData = new InitFbData();
        initFbData.setReserved(reserved);
        initFbData.setDataVersion(dataVersion);
        initFbData.setResvered1((char) resevred1);
        initFbData.setResvered2(resevred2);
        initFbData.setBoardSum(boardSum);
        initFbData.setDeviceNodeSum(deviceNodeSum);
        initFbData.setPhyLinkSum(phyLinkSum);
        initFbData.setPhyPortSum(phyPortSum);

        List<DeviceNodeFbData> deviceNodeFbDatas = new ArrayList<>();
        for (int deviceSize = 0; deviceSize < deviceNodeSum; deviceSize++) {
            offset += 2;
            System.out.println("解析第" + deviceSize + "个芯片节点...................");
            DeviceNodeFbData deviceNodeFbData = new DeviceNodeFbData();
            Integer pahysicalId = Util.getInt(initFbDataByte, offset);
            deviceNodeFbData.setPhysicalId(pahysicalId);
            System.out.println("第" + deviceSize + "个芯片节点.........physicalId:" + pahysicalId);
            offset += INT_LENGTH;
            deviceNodeFbData.setOneRouteLen(Util.getShort(initFbDataByte, offset));
            offset += SHORT_LENGTH;

            short portEntrySize = Util.getShort(initFbDataByte, offset);
            System.out.println("端口口路由表项的个数..............." + portEntrySize);
            offset += SHORT_LENGTH;

            deviceNodeFbData.setPortEntrySize(portEntrySize);
            deviceNodeFbData.setReserved(Util.getShort(initFbDataByte, offset));
            offset += SHORT_LENGTH;
            short rioNetId = Util.getShort(initFbDataByte, offset);
            deviceNodeFbData.setRioNetId(rioNetId);
            System.out.println("第" + deviceSize + "个芯片节点.........rioNetId:" + rioNetId);
            offset += SHORT_LENGTH;

            List<PortRouteItem> portRouteTable = new ArrayList<>();
            for (int nodeSize = 0; nodeSize < portEntrySize; portEntrySize++) {
                Short m_inPortId = Util.getShort(initFbDataByte, offset);
                offset += SHORT_LENGTH;
                Short m_dstID = Util.getShort(initFbDataByte, offset);
                offset += SHORT_LENGTH;
                Short outPorts = Util.getShort(initFbDataByte, offset);
                offset += SHORT_LENGTH;
                Short nextHops = Util.getShort(initFbDataByte, offset);
                offset += SHORT_LENGTH;
                short[] m_outPortIds = new short[outPorts];
                short[] m_nextHops = new short[nextHops];
                for (short i = 0; i < outPorts; i++) {
                    Short outport = Util.getShort(initFbDataByte, offset);
                    offset += SHORT_LENGTH;
                    m_outPortIds[i] = outport;
                }
                for (short i = 0; i < nextHops; i++) {
                    Short next = Util.getShort(initFbDataByte, offset);
                    offset += SHORT_LENGTH;
                    m_nextHops[i] = next;
                }
                PortRouteItem portRouteItem = new PortRouteItem(m_inPortId, m_dstID, outPorts, nextHops, m_outPortIds, m_nextHops);
                portRouteTable.add(portRouteItem);
            }
            deviceNodeFbDatas.add(deviceNodeFbData);
        }
        initFbData.setDeviceNodeFbDataList(deviceNodeFbDatas);
        List<PhysicalLink> physicalLinks = new ArrayList<>();
        for (int i = 0; i < phyLinkSum; i++) {
            System.out.println("解析第" + i + "个物理链路.................");
            offset += 2;
            PhysicalLink physicalLink = new PhysicalLink();
            physicalLinks.add(physicalLink);
            Short riontId = Util.getShort(initFbDataByte, offset);
            offset += 2;
            short portId = Util.getShort(initFbDataByte, offset);
            offset += 2;
            System.out.println("链路起点riontId............." + riontId + ", portId.........." + portId);
            riontId = Util.getShort(initFbDataByte, offset);
            offset += 2;
            portId = Util.getShort(initFbDataByte, offset);
            offset += 2;
            System.out.println("链路终点点riontId............." + riontId + ", portId.........." + portId);
            int startPhyAddr = Util.getInt(initFbDataByte, offset);
            offset += 4;
            System.out.println("startPhyAddr............." + startPhyAddr);
            int endPhyAddr = Util.getInt(initFbDataByte, offset);
            offset += 4;
            System.out.println("endPhyAddr............." + endPhyAddr);
            int bandwidthAvailble = Util.getInt(initFbDataByte, offset);
            offset += 4;
            System.out.println("bandwidthAvailble............." + bandwidthAvailble);
            byte str = Util.getByte(initFbDataByte, offset);
            offset += 4;
            System.out.println("str............." + str);
            byte b1 = Util.getByte(initFbDataByte, offset);
            System.out.println("b1 b2 b3" + "" + b1 + ",");
        }

        List<PhysicalPort> physicalPorts = new ArrayList<>();
        for (int physicalPortSize = 0; physicalPortSize < phyPortSum; physicalPortSize++) {
            offset += 2;
            System.out.println("解析第" + physicalPortSize + "个物理端口.................");
            int physicalPortId = Util.getInt(initFbDataByte, offset);
            short rionetId = Util.getShort(initFbDataByte, offset);
            offset += 2;
            short portId = Util.getShort(initFbDataByte, offset);
            offset += 2;
            System.out.println("rionetId........" + rionetId + ",portId......." + portId);
//            offset += INT_LENGTH;
//16-bit rionet id + 16-bit portId
            int physicalAddr = Util.getInt(initFbDataByte, offset);
            System.out.println("物理地址........." + physicalAddr);
            offset += INT_LENGTH;
//            String portBit = Util.byteToBit(initFbDataByte[offset]);
//            offset += CHAR_LENGTH;
//            char resvered = portBit.charAt(0);
//            String portQuality = portBit.substring(1, 4); //端口质量等级
//            String portMode = portBit.substring(4, 8);
            byte str = Util.getByte(initFbDataByte, offset);
            offset++;
            System.out.println("str..............." + str);
//            //端口模式,0001 1x,0010 4x
//            byte reserved1 = Util.getByte(initFbDataByte, offset);
//            offset += CHAR_LENGTH;
            byte reserved1 = Util.getByte(initFbDataByte, offset);
            System.out.println("reserved1.........." + reserved1);

            offset++;
            short routeItems = Util.getShort(initFbDataByte, offset);//路录表项的个数

            System.out.println("路由表项个数.........." + routeItems);
            offset += SHORT_LENGTH;

            int bandwidthCap = Util.getInt(initFbDataByte, offset); //端口能力带宽（Mbps）
            System.out.println("端口能力带宽.........." + bandwidthCap);
            offset += INT_LENGTH;

            int bandwidthAvail = Util.getInt(initFbDataByte, offset); //端口实际平均带宽
            System.out.println("端口实际平均带宽.........." + bandwidthAvail);
            offset += INT_LENGTH;
            List<PortRouteItem> portRouteItems = new ArrayList<>();
            for (int nodeSize = 0; nodeSize < routeItems; nodeSize++) {
                Short m_inPortId = Util.getShort(initFbDataByte, offset);
                offset += SHORT_LENGTH;

                Short m_dstID = Util.getShort(initFbDataByte, offset);
                offset += SHORT_LENGTH;

                Short outPorts = Util.getShort(initFbDataByte, offset);
                offset += SHORT_LENGTH;

                Short nextHops = Util.getShort(initFbDataByte, offset);
                offset += SHORT_LENGTH;

                short[] m_outPortIds = new short[outPorts];
                short[] m_nextHops = new short[nextHops];

                for (short i = 0; i < outPorts; i++) {
                    Short outport = Util.getShort(initFbDataByte, offset);
                    offset += SHORT_LENGTH;
                    m_outPortIds[i] = outport;
                }
                for (short i = 0; i < nextHops; i++) {
                    Short next = Util.getShort(initFbDataByte, offset);
                    offset += SHORT_LENGTH;
                    m_nextHops[i] = next;
                }
                PortRouteItem portRouteItem = new PortRouteItem(m_inPortId, m_dstID, outPorts, nextHops, m_outPortIds, m_nextHops);
                portRouteItems.add(portRouteItem);
            }
//            PhysicalPort physicalPort = new PhysicalPort(physicalPortId, physicalAddr, resvered, portQuality, portMode, (char) reserved1, routeItems, bandwidthCap, bandwidthAvail, portRouteItems);
//            physicalPorts.add(physicalPort);
        }
        initFbData.setPhysicalPorts(physicalPorts);
        List<BoardFbData> boardFbDatas = new ArrayList<>();
        for (int boardSize = 0; boardSize < boardSum; boardSize++) {
            offset += 2;
            System.out.println("解析第" + boardSize + "个板卡.................");

            BoardFbData boardFbData = new BoardFbData();
            boardFbData.setBoradId(Util.getShort(initFbDataByte, offset));
            offset += SHORT_LENGTH;

            boardFbData.setBoardModel(Util.getShort(initFbDataByte, offset));
            offset += SHORT_LENGTH;

            boardFbData.setBoardSize(Util.getShort(initFbDataByte, offset));
            offset += SHORT_LENGTH;

            boardFbData.setBoardSN(Util.getShort(initFbDataByte, offset));
            offset += SHORT_LENGTH;

            boardFbData.setBoardType(Util.getShort(initFbDataByte, offset));
            offset += SHORT_LENGTH;

            String resvd = Util.byteToBit(initFbDataByte[offset]).substring(0, 6);
            offset += CHAR_LENGTH;

            String boardStatus = Util.byteToBit(initFbDataByte[offset]).substring(6, 8);
            boardFbData.setResvd(resvd);
            boardFbData.setBoardStatus(boardStatus);
            boardFbData.setBoardUseStatus(Util.getChar(initFbDataByte, offset));
            offset += CHAR_LENGTH;
//            byte[] boardNameByte = new byte[32];
//            System.arraycopy(initFbDataByte, offset, boardNameByte, 0, 32);
//            offset += 32;
//            String boardName = new String(boardNameByte, "GBK");
//            boardFbData.setBoardName(boardName);
            boardFbDatas.add(boardFbData);
        }
        initFbData.setBoardFbDatas(boardFbDatas);
        return initFbData;
    }

    /**
     * 解析芯片节点信息
     *
     * @param file
     * @return
     */
    public Object decodeDeviceNodeFbData(File file) throws IOException {

        byte[] nodeFbData = Util.getContent(file.getPath());

//        Util.getShort(nodeFbData,0);
        DeviceNodeFbData deviceNodeFbData = new DeviceNodeFbData();
        int offset = 0;
        deviceNodeFbData.setPhysicalId(Util.getInt(nodeFbData, offset));
        offset += INT_LENGTH;
        deviceNodeFbData.setOneRouteLen(Util.getShort(nodeFbData, offset));
        offset += 2;
        short portEntrySize = Util.getShort(nodeFbData, offset);
        offset += 2;
        deviceNodeFbData.setPortEntrySize(portEntrySize);
        deviceNodeFbData.setReserved(Util.getShort(nodeFbData, offset));
        offset += 2;

        deviceNodeFbData.setRioNetId(Util.getShort(nodeFbData, offset));
        offset += SHORT_LENGTH;


        if (nodeFbData.length > 12) {
            List<PortRouteItem> portRouteTable = new ArrayList<>();
            for (int nodeSize = 0; nodeSize < portEntrySize; portEntrySize++) {
                Short m_inPortId = Util.getShort(nodeFbData, offset);
                offset += SHORT_LENGTH;
                Short m_dstID = Util.getShort(nodeFbData, offset);
                offset += SHORT_LENGTH;
                Short outPorts = Util.getShort(nodeFbData, offset);
                offset += SHORT_LENGTH;
                Short nextHops = Util.getShort(nodeFbData, offset);
                offset += SHORT_LENGTH;
                short[] m_outPortIds = new short[outPorts];
                short[] m_nextHops = new short[nextHops];

                for (short i = 0; i < outPorts; i++) {
                    Short outport = Util.getShort(nodeFbData, offset);
                    offset += SHORT_LENGTH;
                    m_outPortIds[i] = outport;
                }
                for (short i = 0; i < nextHops; i++) {
                    Short next = Util.getShort(nodeFbData, offset);
                    offset += SHORT_LENGTH;

                    m_nextHops[i] = next;
                }
                PortRouteItem portRouteItem = new PortRouteItem(m_inPortId, m_dstID, outPorts, nextHops, m_outPortIds, m_nextHops);
                portRouteTable.add(portRouteItem);
            }
        }
        return deviceNodeFbData;
    }

    /**
     * 解析从flash获取xml
     */
    public byte[] xmlFromFlash(File file) throws IOException {
        byte[] xml = Util.getContent(file.getPath());
        return xml;
    }

    /**
     * 查询板卡信息
     */
    public Object decodeBoardInfo(File file) throws IOException {
        byte[] boardInfo = Util.getContent(file.getPath());

//        Util.getShort(nodeFbData,0);
        BoardFbData boardFbData = new BoardFbData();
        int offset = 0;
        boardFbData.setBoradId(Util.getShort(boardInfo, offset));
        offset += SHORT_LENGTH;
        boardFbData.setBoardModel(Util.getShort(boardInfo, offset));
        offset += SHORT_LENGTH;

        boardFbData.setBoardSize(Util.getShort(boardInfo, offset));
        offset += SHORT_LENGTH;

        boardFbData.setBoardSN(Util.getShort(boardInfo, offset));
        offset += SHORT_LENGTH;

        boardFbData.setBoardType(Util.getShort(boardInfo, offset));
        offset += SHORT_LENGTH;
        String resvd = Util.byteToBit(boardInfo[10]).substring(0, 5);
        String boardStatus = Util.byteToBit(boardInfo[10]).substring(6, 7);
        offset += 1;

        boardFbData.setResvd(resvd);
        boardFbData.setBoardStatus(boardStatus);

        boardFbData.setBoardUseStatus(Util.getChar(boardInfo, offset));
        byte[] boardNameByte = new byte[32];
        System.arraycopy(boardInfo, offset, boardNameByte, 0, 32);

        String boardName = new String(boardNameByte, "GBK");
        boardFbData.setBoardName(boardName);
        return boardFbData;
    }


    /**
     * 所有物理链路统计信息
     */
    public static Object decodePhylinkStatics(File file) throws IOException {
        byte[] phylinkStatics = Util.getContent(file.getPath());

//        Util.getShort(nodeFbData,0);
        PhyLinkStaticsFbData phyLinkStaticsFbData = new PhyLinkStaticsFbData();
        int offset = 0;
        int linkSum = Util.getInt(phylinkStatics, offset);
        offset += INT_LENGTH;
        phyLinkStaticsFbData.setLinkSum(linkSum);
        phyLinkStaticsFbData.setOneLinkDataLen(Util.getShort(phylinkStatics, offset += SHORT_LENGTH));
        offset += SHORT_LENGTH;
        phyLinkStaticsFbData.setReserved(Util.getShort(phylinkStatics, offset += SHORT_LENGTH));
        offset += SHORT_LENGTH;

        List<PhyLinkStatic> phyLinkStatics = new ArrayList<>();
        for (int i = 0; i < linkSum; i++) {
            PhyLinkStatic phyLinkStatic = new PhyLinkStatic();
            phyLinkStatic.setStartRioNetId(Util.getShort(phylinkStatics, offset));
            offset += SHORT_LENGTH;
            phyLinkStatic.setStartPortId(Util.getShort(phylinkStatics, offset));
            offset += SHORT_LENGTH;
            phyLinkStatic.setEndRioNetId(Util.getShort(phylinkStatics, offset));
            offset += SHORT_LENGTH;
            phyLinkStatic.setStartPortId(Util.getShort(phylinkStatics, offset));
            offset += SHORT_LENGTH;
            PhyPortStatic startPhyPortStatic = new PhyPortStatic();
            startPhyPortStatic.setInUniPkts(Util.getLong(phylinkStatics, offset));
            offset += LONG_LENGTH;
            startPhyPortStatic.setInReSyms(Util.getLong(phylinkStatics, offset));
            offset += LONG_LENGTH;

            startPhyPortStatic.setInUniPkts(Util.getLong(phylinkStatics, offset));
            offset += LONG_LENGTH;

            startPhyPortStatic.setOutUniPkts(Util.getLong(phylinkStatics, offset));
            offset += LONG_LENGTH;

            startPhyPortStatic.setOutReSyms(Util.getLong(phylinkStatics, offset));
            offset += LONG_LENGTH;

            startPhyPortStatic.setOutUni32Bits(Util.getLong(phylinkStatics, offset));
            offset += LONG_LENGTH;


            PhyPortStatic endPhyPortStatic = new PhyPortStatic();
            endPhyPortStatic.setInUniPkts(Util.getLong(phylinkStatics, offset));
            offset += LONG_LENGTH;

            endPhyPortStatic.setInReSyms(Util.getLong(phylinkStatics, offset));
            offset += LONG_LENGTH;

            endPhyPortStatic.setInUniPkts(Util.getLong(phylinkStatics, offset));
            offset += LONG_LENGTH;

            endPhyPortStatic.setOutUniPkts(Util.getLong(phylinkStatics, offset));
            offset += LONG_LENGTH;

            endPhyPortStatic.setOutReSyms(Util.getLong(phylinkStatics, offset));
            offset += LONG_LENGTH;

            endPhyPortStatic.setOutUni32Bits(Util.getLong(phylinkStatics, offset));
            offset += LONG_LENGTH;
            phyLinkStatic.setStartPhyPortStatic(startPhyPortStatic);
            phyLinkStatic.setEndPhyPortStatic(endPhyPortStatic);
            phyLinkStatics.add(phyLinkStatic);
        }
        phyLinkStaticsFbData.setPhyLinkStatics(phyLinkStatics);
        return phyLinkStaticsFbData;
    }

    /**
     * 查询板卡信息
     */
    public static void main(String[] args) throws IOException {
        File file = new File("111");
        FileOutputStream fileOutputStream = new
                FileOutputStream(file);
        byte[] bytes = {0, 0, 0, 9, 0, 104, 0, 0, 0, 5, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, -62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 107, -66, 0, 0, 0, 0, 0, 0, 35, -60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -78, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 6, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 40, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 24, 0, 0, 0, 0, 0, 0, 6, -9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, -21, 0, 0, 0, 0, 0, 0, 6, -7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, -25, 0, 1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0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 107, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 124};

        fileOutputStream.write(bytes);
        fileOutputStream.flush();
        decodePhylinkStatics(file);

    }
}
